package com.example.m1;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
//这个可以加在方法上，这个方法会自动处理消息

public class Consumer {
//    每个rabbitlistener都会注册成为一个消费者
   @RabbitListener(queues = "helloworld")
    public void receive(String msg){
       System.out.println("ok:"+msg);
   }
    @RabbitListener(queues = "task_queue")
    public void receive2(String msg){
        System.out.println("ok-2:"+msg);
    }

}
